package cn.edu.imau.zy.system.controller;

import cn.edu.imau.zy.common.annotation.LoginUser;
import cn.edu.imau.zy.common.core.controller.BaseController;
import cn.edu.imau.zy.common.core.domain.R;
import cn.edu.imau.zy.common.core.entity.student.StStudent;
import cn.edu.imau.zy.common.core.entity.system.SysAppBanner;
import cn.edu.imau.zy.common.core.entity.system.SysUser;
import cn.edu.imau.zy.system.feign.RemoteStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 小程序二维码 提供者
 *
 * @author wyz
 * @date 2020-07-09
 */
@RestController
@RequestMapping("qr")
public class SysAppQRController extends BaseController {

    @Autowired
    private RemoteStudentService remoteStudentService;

    /**
     * 小程序简单扫码
     */
    @GetMapping("simple/{code}")
    public R simple(@PathVariable("code") Integer code, @LoginUser SysUser user) {
        switch (code) {
            case 1:
                StStudent student = new StStudent();
                student.setStudentId(user.getUserId());
                student.setStudentStatus("1");
                remoteStudentService.editSave(student);
                return R.ok();
            default:
                return R.error("非法代码");
        }
    }

}
